package com.cyan.note.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 财务交易记录实体类
 * 对应数据库表: financial_transactions
 * 
 * @author ZhangzhenYu
 * @since 2025-01-15
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class FinancialTransaction extends BaseEntity {

    /**
     * 所属店铺ID
     */
    private Long shopId;

    /**
     * 交易流水号
     */
    private String transactionNo;

    /**
     * 交易类型
     */
    private String transactionType;

    /**
     * 交易分类
     */
    private String category;

    /**
     * 子分类
     */
    private String subcategory;

    /**
     * 交易金额
     */
    private BigDecimal amount;

    /**
     * 货币类型
     */
    private String currency;

    /**
     * 关联类型
     */
    private String relatedType;

    /**
     * 关联ID
     */
    private Long relatedId;

    /**
     * 支付方式
     */
    private String paymentMethod;

    /**
     * 账户名称
     */
    private String accountName;

    /**
     * 账户号码
     */
    private String accountNumber;

    /**
     * 交易描述
     */
    private String description;

    /**
     * 凭证URL
     */
    private String receiptUrl;

    /**
     * 交易状态
     */
    private String status;

    /**
     * 交易时间
     */
    private LocalDateTime transactionDate;

    /**
     * 记录人ID
     */
    private Long createdBy;

    /**
     * 审核人ID
     */
    private Long verifiedBy;

    /**
     * 审核时间
     */
    private LocalDateTime verifiedAt;

    // 常量定义
    public static class TransactionType {
        public static final String INCOME = "income";
        public static final String EXPENSE = "expense";
    }

    public static class Category {
        // 收入分类
        public static final String ORDER_INCOME = "订单收入";
        public static final String RECHARGE_INCOME = "充值收入";
        public static final String OTHER_INCOME = "其他收入";
        
        // 支出分类
        public static final String LABOR_COST = "人工成本";
        public static final String OPERATION_COST = "运营成本";
        public static final String MANAGEMENT_COST = "管理成本";
        public static final String OTHER_COST = "其他成本";
    }

    public static class Status {
        public static final String PENDING = "pending";
        public static final String COMPLETED = "completed";
        public static final String CANCELLED = "cancelled";
        public static final String FAILED = "failed";
    }

    public static class RelatedType {
        public static final String ORDER = "order";
        public static final String CUSTOMER = "customer";
        public static final String WORKER = "worker";
        public static final String OTHER = "other";
    }
}